﻿@model PagedList.IPagedList<UscSunShine.Models.Request>
@using PagedList.Mvc;

<link href="~/Content/PagedList.css" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Content/bootstrap-select.css")" rel="stylesheet" type="text/css" />
@{
    ViewBag.Title = "我有话说";
}

<div class="jumbotron font-detail">
    <div class="container">
        <center>
            <fieldset>
                <legend>服务信息列表</legend>
                @using (Html.BeginForm("Index", "Request", FormMethod.Get, new { @class = "bs-example bs-example-form" }))
                {
                    <table>
                        <tr>
                            <td width="30%" align="left">
                                受理单位：@Html.DropDownList("departmentID", ViewBag.departmentID as SelectList, "全部", new { @class = "selectpicker" })
                            </td>
                            <td width="15%" align="left">
                                类别：
                                @Html.DropDownList("requestCategory", ViewBag.requestCategory as SelectList,"全部", new { @class = "selectpicker" })
                            </td>
                            <td width="20%" align="left">
                                <div class="input-group">
                                    <span class="input-group-addon">主题：</span>
                                    @Html.TextBox("titleSearchString", ViewBag.currentTitle as string, new { @class = "form-control" })
                                </div>
                            </td>
                            <td width="18%" align="right">
                                <div class="input-group">
                                    <span class="input-group-addon">受理单号：</span>
                                    @Html.TextBox("acceptNumberSearchString", ViewBag.currentTitle as string, new { @class = "form-control" })
                                </div>
                            </td>
                            <td align="right" width="5%">
                                <button type="submit" class="btn btn-default">查 询</button>
                            </td>
                        </tr>
                    </table>
                }
                <table id="infoListTable" class="table table-hover">
                    <tr>
                        <th style ="width:5%">
                            状态
                        </th>
                        <th width="20%" class="longItem">
                            受理单位
                        </th>
                        <th width="5%">
                            类别
                        </th>
                        <th width="45%">
                            主题
                        </th>
                        <th width="15%">
                            提交时间
                        </th>
                        <th>
                            访问次数
                        </th>
                    </tr>

                    @foreach (var item in Model)
                    {
                        <tr>
                            <td style="width:5%">
                                @switch (item.ProcessStatus)
                                {
                                    case UscSunShine.Models.ProcessStatus.按时办结:
                                        <span style="color:green;" class="glyphicon glyphicon-star"></span>
                                        break;
                                    case UscSunShine.Models.ProcessStatus.正在办理:
                                    case UscSunShine.Models.ProcessStatus.已受理:
                                    <span style="color:blue;" class="glyphicon glyphicon-star"></span>
                                        break;
                                    case UscSunShine.Models.ProcessStatus.超期办结:
                                    <span style="color:orange;" class="glyphicon glyphicon-star"></span>
                                        break;
                                    case UscSunShine.Models.ProcessStatus.超期未办结:
                                    <span style="color:red;" class="glyphicon glyphicon-star"></span>
                                        break;
                                }
                            </td>
                            <td width="20%" class="longItem">
                                @Html.DisplayFor(modelItem => item.Department.Name)
                            </td>
                            <td width="5%">
                                @Html.DisplayFor(modelItem => item.RequestCategory)
                            </td>
                            <td width="45%" class="longItem">
                                @Html.ActionLink(item.Title, "Details", new { id = item.ID })
                            </td>
                            <td width="15%">
                                @Html.DisplayFor(s => item.AcceptDate)
                            </td>
                            <td>
                                @Html.DisplayFor(modelItem => item.ViewTimes)
                            </td>
                        </tr>
                    }

                </table>


                <div align="center">
                    第 @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber) 页，共 @Model.PageCount 页
                                        @Html.PagedListPager(Model, page => Url.Action("Index", new
                        {
                            page,
                            currentDepartmentID = ViewBag.currentDepartmentID,
                            currentCategory = ViewBag.currentCategory,
                            currentTitle = ViewBag.currentTitle,
                            currentNumber = ViewBag.currentNumber
                        }))
                    <div style="text-align:left;margin-left:20px;">
                        <span style="color:green;" class="glyphicon glyphicon-star">按时办结&nbsp;</span>
                        <span style="color:blue;" class="glyphicon glyphicon-star">正在办理&nbsp;</span>
                        <span style="color:orange;" class="glyphicon glyphicon-star">超期办结&nbsp;</span>
                        <span style="color:red;" class="glyphicon glyphicon-star">超期未办结&nbsp;</span>
                    </div>
                </div>
            </fieldset>
        </center>
    </div>
</div>
<script src="@Url.Content("~/Scripts/jquery-2.1.1.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/bootstrap-select.min.js")" type="text/javascript"></script>
<script>
    $('#requestCategory').selectpicker({
        width: '80px'
    });
</script>